package com.starbaba.mainbanner.info.view;



import com.opensymphony.xwork2.Action;
import com.starbaba.core.utils.PropertyParamMapBuilder;
import com.starbaba.core.utils.Struts2Utils;
import com.starbaba.core.web.struts2.BaseAction;
import com.starbaba.mainbanner.info.model.MainbannerInfoVO;
import com.starbaba.mainbanner.info.view.MainbannerInfoListVO;


public class MainbannerInfoAction extends BaseAction {

    private static final long serialVersionUID = 1L;

    public MainbannerInfoAction() {
		this.voClass = MainbannerInfoVO.class;
		this.pkNameArray = new String[] { "id" };
	}

	public void beforeAdd() {

	}

	public String save() {
		return super.save();
	}
	
	@Override
	protected void beforeData() throws Exception {
		super.beforeData();
		paramsMap = PropertyParamMapBuilder.buildFromHttpRequest(
				Struts2Utils.getRequest(), paramsMap);
		MainbannerInfoListVO entityList = (MainbannerInfoListVO) getEntityListVO();
		entityList.set_neq_controlid((String) paramsMap.get("id"));
		entityList.set_ieq_status("1");
	}

	@Override
	public void queryData() {
		try {
			page = getPage();
			page = this.getService().doQuery(MainbannerInfoVO.class, this.entityListVO);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}


	public String list() {
		return super.list();
	}

	public String getBase() {
		paramsMap = PropertyParamMapBuilder.buildFromHttpRequest(
				Struts2Utils.getRequest(), paramsMap);
		String channel = (String) paramsMap.get("channel");
		String platform = (String) paramsMap.get("platform");
		String maxVersionCode = (String) paramsMap.get("maxVersionCode");
		String minVersionCode = (String) paramsMap.get("minVersionCode");
		String startTime = (String) paramsMap.get("startTime");
		String endTime = (String) paramsMap.get("endTime");
		paramsMap.put("oldChannel", channel);
		paramsMap.put("oldPlatform", platform);
		paramsMap.put("oldMaxVersionCode", maxVersionCode);
		paramsMap.put("oldMinVersionCode", minVersionCode);
		paramsMap.put("oldStartTime", startTime);
		paramsMap.put("oldEndTime", endTime);
		return Action.SUCCESS;
	}

}
